package com.yaoxuguang.concurrence.wait_notify.join.join_sleep_different;

/**
 * @author yaoxuguang
 * @Title: yao-interview
 * @Package com.yaoxuguang.concurrence.wait_notify.join.join_sleep_different
 * @Description: sleep和join的不同，sleep不释放锁
 * @date 2018年12月24日13:58
 */
public class SleepThreadA extends Thread{
    private SleepThreadB sleepThreadB;

    public SleepThreadA(SleepThreadB sleepThreadB) {
        this.sleepThreadB = sleepThreadB;
    }

    @Override
    public void run() {
        try {
            synchronized (sleepThreadB){
                sleepThreadB.start();
                Thread.sleep(6000);
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
